home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10275 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: sundog.tiac.net!usenet
  2. From: mao@tiac.net (Mark A. Odell)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: given: char foo[80]; there is no such thing as element foo[80] correct? (i.e. foo[80] = '\0' is beyond the array boundary)
  5. Date: Sat, 16 Mar 1996 14:36:13 GMT
  6. Organization: None!
  7. Message-ID: <314ad16d.86316693@news>
  8. References: <3148DBB6.1353@hawaii.edu> <1996Mar15.183302.5364@zcon.com>
  9. Reply-To: mao@tiac.net
  10. NNTP-Posting-Host: cygnus.tiac.net
  11. X-Newsreader: Forte Agent .99d/32.182
  12.  
  13. On Fri, 15 Mar 1996 18:33:02 GMT, szh@zcon.com (Syed Zaeem Hosain) wrote:
  14.  
  15. >In article <3148DBB6.1353@hawaii.edu>, Dave Carien <davec@hawaii.edu> writes:
  16. >>Yes or no on this, I just recently got confused by two different books. I 
  17. >>assume that the declaration foo[80] allocates storage for elements 0-79.
  18.  
  19. // Yes. This works nice and safely for any array of known size.
  20. foo[sizeof(foo)-1] = '\0';
  21.  
  22.  
  23.  
  24. +---------------------------------------------------+
  25. |                                                   |
  26. | Mark A. Odell                        mao@tiac.net |
  27. |                                                   |
  28. +---------------------------------------------------+
  29.